<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      .title {
        background-color: green;
      }
    </style>
  </head>
  <body>
    <!-- 1. 创建一个根标签  -->
    <div id="root"></div>

    <!-- 2. 引入react库文件和babel 
    注意: 先引入react后引入react-dom. 因为react-dom依赖react
    -->
    <script crossorigin src="./js/react.development.js"></script>
    <script crossorigin src="./js//react-dom.development.js"></script>
    <script src="./js/babel.min.js"></script>

    <!-- 3. 根据数据动态创建元素,最后渲染到页面上 -->
    <!-- type="text/babel" 作用: 让babel编译这个script里面的代码. 会将jsx编译成 React.createElement -->
    <script type="text/babel">
      const div = (
        <div>
          <h1 id="title" className="title">哈哈哈</h1>
          {/*css中属性有-的要写成小驼峰, 单位是px的可以忽略.其他单位不能忽略*/}
          <p style={{ backgroundColor: 'red', width: 300, height: '100rem' }}>
            嘿嘿嘿
          </p>
        </div>
      )
      ReactDOM.render(div, document.getElementById('root'))
    </script>
  </body>
</html>
